import http from '@/api'
import { ADMIN_MODULE } from '@/api/helper/prefix'
import type { IPage } from '@/api/types';
import type { DetailModePictureQuery, DetailModePictureRow, DetailModePictureForm } from '@/api/types/detailmodel/detailModePicture'
import type { UploadRawFile } from "element-plus/es/components/upload/src/upload";
import type { AxiosRequestConfig } from 'axios';

/**
 * 查询列表
 * @param params
 * @returns {*}
 */
export const getDetailModePictureListApi = (params: { limit: number; belongId: any; page: number }) => {
    return http.get<IPage<DetailModePictureRow>>(ADMIN_MODULE + `/detail-mode-picture`, params)
}

/**
 * 添加
 * @param params
 * @returns {*}
 */
export const createDetailModePictureApi = (params: DetailModePictureForm) => {
    return http.post(ADMIN_MODULE + `/detail-mode-picture`, params)
}

/**
 * 批量添加
 * @param params
 * @returns {*}
 */
export const batchCreateDetailModePictureApi = (params: DetailModePictureForm[]) => {
    return http.post(ADMIN_MODULE + `/detail-mode-picture/batchSave`, params)
}

/**
 * 修改
 * @param params
 * @returns {*}
 */
export const updateDetailModePictureApi = (params: DetailModePictureForm) => {
    return http.put(ADMIN_MODULE + `/detail-mode-picture`, params)
}

/**
 * 删除
 * @param params
 * @returns {*}
 */
export const removeDetailModePictureApi = (params: { ids: (string | number)[] }) => {
    return http.delete(ADMIN_MODULE + `/detail-mode-picture`, params)
}

/**
 * 获取详情
 * @param params
 * @returns {*}
 */
export const getDetailModePictureDetailApi = (params: { id: number }) => {
    const { id } = params
    return http.get<DetailModePictureRow>(ADMIN_MODULE + `/detail-mode-picture/${id}`)
}

/**
 * 导入excel
 * @param params
 */
export const importDetailModePictureExcelApi = (params : UploadRawFile, config?: AxiosRequestConfig<any> | undefined) => {
    return http.upload(ADMIN_MODULE + `/detail-mode-picture/import`, params, config)
}

/**
 * 导出excel
 * @param params
 * @returns {*}
 */
export const exportDetailModePictureExcelApi  = (params: DetailModePictureQuery) => {
    return http.download(ADMIN_MODULE + `/detail-mode-picture/export`, params)
}